{% extends 'TopxiaAdminBundle::layout.html.twig' %}

{% set menu = 'admin_report_status_list' %}
{% set script_controller = 'system/report-status' %}

{% block main %}
  <table class="table table-striped table-bordered">
    <thead>
    <tr>
      <th width="40%">{{ '环境检测'|trans }}</th>
      <th width="20%">{{ '推荐配置'|trans }}</th>
      <th width="20%">{{ '当前状态'|trans }}</th>
      <th width="20%">{{ '最低要求'|trans }}</th>
    </tr>
    </thead>
    <tbody>

    <tr>
      <td>{{ '操作系统'|trans }}</td>
      <td>Linux</td>
      <td>
        <span class="text-success">√ {{ env.os }}</span>
      </td>
      <td>--</td>
    </tr>

    <tr>
      <td>{{ 'PHP版本'|trans }} （<a href="{{ path('admin_report_status_php') }}">{{ '更多信息'|trans }}</a>）</td>
      <td>5.5.x</td>
      <td>
        {% if env.phpVersionOk %}
          <span class="text-success">√ {{ env.phpVersion }}</span>
        {% else %}
          <span class="text-danger">X {{ env.phpVersion }}</span>
        {% endif %}
      </td>
      <td>5.3.3</td>
    </tr>

    <tr>
      <td>{{ 'PHP运行用户'|trans }}</td>
      <td>-</td>
      <td>
        <span class="text-success">√ {{ env.user }}</span>
      </td>
      <td>-</td>
    </tr>

    <tr>
      <td>{{ '安全模式'|trans }}</td>
      <td>{{ '关闭'|trans }}</td>
      <td>
        {% if env.safemode == 'Off' %}
          <span class="text-danger">X {{ '开启'|trans }}</span>
        {% else %}
          <span class="text-success">√ {{ '关闭'|trans }}</span>
        {% endif %}
      </td>
      <td>{{ '关闭'|trans }}</td>
    </tr>

    <tr>
      <td>PDO_MySQL</td>
      <td>{{ '必须'|trans }}</td>
      <td>
        {% if env.pdoMysqlOk %}
          <span class="text-success">√ {{ '已安装'|trans }}</span>
        {% else %}
          <span class="text-danger">X {{ '尚未安装MySQL_PDO'|trans }}</span>
        {% endif %}
      </td>
      <td>{{ '必须'|trans }}</td>
    </tr>

    <tr>
      <td>
        {{ '文件上传大小'|trans }}
        <div class="text-muted">{{ '该值决定可以上传视频的最大大小'|trans }}</div>
      </td>
      <td>{{ '大于200M'|trans }}</td>
      <td>
        {% if env.uploadMaxFilesizeOk %}
          <span class="text-success">√ {{ env.uploadMaxFilesize }}</span>
        {% else %}
          <span class="text-danger">X {{ env.uploadMaxFilesize }}</span>
        {% endif %}
      </td>
      <td>2M</td>
    </tr>

    <tr>
      <td>
        {{ '表单数据大小'|trans }}
        <div class="text-muted">{{ '该值不能小于文件上传大小的值'|trans }}</div>
      </td>
      <td>{{ '大于200M'|trans }}</td>
      <td>
        {% if env.postMaxsizeOk %}
          <span class="text-success">√ {{ env.postMaxsize }}</span>
        {% else %}
          <span class="text-danger">X {{ env.postMaxsize }}</span>
        {% endif %}
      </td>
      <td>8M</td>
    </tr>

    <tr>
      <td>
        {{ 'PHP脚本最大执行时间'|trans }}
        <div class="text-muted">{{ '该值决定上传视频时，最长可使用的时间'|trans }}</div>
      </td>
      <td>{{ '大于300秒'|trans }}</td>
      <td>
        {% if env.maxExecutionTimeOk %}
          <span class="text-success">√ {{ env.maxExecutionTime }}{{ '秒'|trans }}</span>
        {% else %}
          <span class="text-danger">X {{ env.maxExecutionTime }}{{ '秒'|trans }}</span>
        {% endif %}
      </td>
      <td>{{ '30秒'|trans }}</td>
    </tr>

    <tr>
      <td>
        {{ 'PHP扩展：'|trans }}mbstring
        <div class="text-muted">{{ '该扩展用于处理中文字符'|trans }}</div>
      </td>
      <td>{{ '必须'|trans }}</td>
      <td>
        {% if env.mbstringOk %}
          <span class="text-success">√ {{ '已安装'|trans }}</span>
        {% else %}
          <span class="text-danger">X {{ '尚未安装'|trans }}</span>
        {% endif %}
      </td>
      <td>{{ '必须'|trans }}</td>
    </tr>

    <tr>
      <td>
        {{ 'PHP扩展：'|trans }}curl
        <div class="text-muted">{{ '该扩展用于远程读取文件'|trans }}</div>
      </td>
      <td>{{ '必须'|trans }}</td>
      <td>
        {% if env.curlOk %}
          <span class="text-success">√ {{ '已安装'|trans }}</span>
        {% else %}
          <span class="text-danger">X {{ '尚未安装'|trans }}</span>
        {% endif %}
      </td>
      <td>{{ '必须'|trans }}</td>
    </tr>

    <tr>
      <td>
        {{ 'PHP扩展：'|trans }}GD
        <div class="text-muted">{{ '该扩展用于处理图片'|trans }}</div>
      </td>
      <td>{{ '必须'|trans }}</td>
      <td>
        {% if env.gdOk %}
          <span class="text-success">√ {{ '已安装'|trans }}</span>
        {% else %}
          <span class="text-danger">X {{ '尚未安装'|trans }}</span>
        {% endif %}
      </td>
      <td>{{ '必须'|trans }}</td>
    </tr>
    </tbody>
  </table>

  <table class="table table-hover table-striped table-bordered">
    <thead>
    <tr>
      <th width="60%">{{ '通信情况'|trans }}</th>
      <th width="40%">{{ '状态'|trans }}</th>
    </tr>
    </thead>
    <tbody>
    <tr>
      <td>{{ '与Discuz Ucenter的连接'|trans }}</td>
      <td><span class="text-muted js-ucenter-check"
                data-url="{{ path('admin_report_status_ucenter') }}">{{ '正在检测.....'|trans }}</span></td>
    </tr>
    {% if setting("cloud_email.status")|default("disable") == "disable" %}
      <tr>
        <td>{{ '邮件发送'|trans }} <i class="glyphicon glyphicon-info-sign text-info" data-toggle="tooltip" data-placement="top"
                    title="{{ '每次检测，都会向当前用户发一封测试邮件，请保证当前用户的邮箱正确,邮件异常请到系统日志查看'|trans }}"></i></td>
        <td><span class="text-muted js-email-send-check" data-url="{{ path('admin_report_status_email_send') }}">{{ '正在检测.....'|trans }}</span>
        </td>
      </tr>
    {% endif %}
    </tbody>
  </table>

  <div style="overflow:auto;max-height:400px;word-break:break-all;">
    <table class="table table-hover table-striped table-bordered" id="direcory-check-table"
           data-url="{{ path('admin_report_status_directory') }}">
      <thead>
      <tr>
        <th width="60%">{{ '系统文件、目录权限检查'|trans }}</th>
        <th width="20%">{{ '当前状态'|trans }}</th>
        <th width="20%">{{ '所需状态'|trans }}</th>
      </tr>
      </thead>
      <tbody>
      <tr>
        <td colspan="6" style="text-align: center;color: #c1c1c1;padding: 50px;">{{ '正常扫描文件......'|trans }}</td>
      </tr>
      </tbody>
    </table>
  </div>

  <div style="overflow:auto;max-height:400px;word-break:break-all;">
    <table class="table table-hover table-striped table-bordered" id="direcory-check-table"
           data-url="{{ path('admin_report_status_directory') }}">
      <thead>
      <tr>
        <th width="30%">{{ '系统空间占用'|trans }}</th>
        <th width="20%">{{ '可用'|trans }}</th>
        <th width="25%">{{ '总共'|trans }}</th>
        <th width="25%">{{ '剩余'|trans }}</th>
      </tr>
      </thead>
      <tbody>
        {% for diskUsage in systemDiskUsage %}
          <tr>
            <td>
              {{ diskUsage.name }}
              <a class="glyphicon glyphicon-question-sign text-muted pull-center" data-toggle="popover"
                 data-trigger="hover" data-placement="top" data-content="{{ diskUsage.title }}">
              </a>
            </td>
            <td> {{ diskUsage.free }} </td>
            <td> {{ diskUsage.total }} </td>
            <td> {{ diskUsage.rate }} </td>
          </tr>
        {% endfor %}
      </tbody>
    </table>
  </div>


{% endblock %}